<template>
	<view class="login">
		<!-- f1: 用户名输入框组 -->
		<view class="input-group">
			<uni-easyinput type="text" v-model="uname" placeholder="用户名/邮箱/手机号" :inputBorder="false" ></uni-easyinput>
		</view>
		<!-- f2: 密码输入框组 -->
		<view class="input-group">
			<uni-easyinput type="password" v-model="upwd" placeholder="请输入密码" :inputBorder="false"></uni-easyinput>
			<text>|</text>
			<navigator url="../../pages/index/index" >忘记密码</navigator>
		</view>
		<!-- f3: 登录按钮 -->
		<view class="button">
			<text>登 录</text>
		</view>
		<!-- f4: 跳转注册组件页面的文字 -->
		<view class="go" @click="jumpToRegister">
			<text>还没账号？立即注册</text>
		</view>
		<!-- f5: 其他登录方式 -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				uname: '',
				upwd: '',
			}
		},
		mounted() {
			uni.setNavigationBarTitle({
				title:'用户登录'
			})
		},
		methods: {
			jumpToRegister() {
				//目标：隐藏登录组件，显示注册组件
				//子组件通过发射自定义事件方式向父组件传消息
				this.$emit('xz-register')
			},
		}
	}
</script>

<style lang="scss">
	.login {
		position: absolute;
		top: 0;
		width: 750rpx;
		padding: 60rpx 40rpx;

		.input-group {
			border-bottom: 1px solid $uni-text-color-grey;
			margin: $uni-spacing-col-lg;
			display: flex;
			align-items: center;

			text {
				color: $uni-text-color-grey;
				margin: 0 $uni-spacing-col-base;
				font-size: $uni-font-size-sm;
			}
			navigator{
				color: $uni-text-color-grey;
				font-size: $uni-font-size-sm;
			}
		}
		
		.button{
			margin: 0 auto;
			margin-top: 60rpx;
			background-color: $xz-theme;
			border-radius: $uni-border-radius-lg;
			text-align: center;
			color: #fff;
			line-height: 80rpx;
			width: 90%;
			font-size: $uni-font-size-lg;
			
			&:active{
				background-color: darken($xz-theme ,5%);
			}
		}
		
		.go{
			margin-left: 10px;
			margin-top: $uni-spacing-col-lg;
		}
	}
</style>
